package File;

import java.io.FileWriter;
import java.io.IOException;
import java.io.Writer;

//文件操作Writer(字符流)
public class Demo9 {
    public static void main(String[] args) throws IOException {
        //这样在打开文件的时候会将文件里面的内容进行清空
//        try(Writer writer = new FileWriter("./src/test.txt")){
//            writer.write("你好世界");
//        }
        //在文件原本内容上进行追加
        try(Writer writer = new FileWriter("./src/test.txt",true)){
            writer.write("hello world");
        }
    }
}
